const Utils = require('./Utils.js')
Utils.init()

let seconds = 0
let num = 0
let flag = true
while (flag) {
    sleep(1000)
    if (Utils.findPictureTap('准备', 0.8)) {
        num++
        if (num === 1) seconds = 900
        else seconds = 120
        Utils.waitTime(seconds)
        if (num != 4) {
            while (!Utils.findPicture('准备', 0.8)) {
                sleep(1000)
                log('已等待 ' + ++seconds + ' 秒')
            }
        }
    }
    log('已等待 ' + ++seconds + ' 秒')
    if (Utils.findPicture('胜利')) {
        log('阴界之门 - 成功')
        while (!Utils.findPictureTap('返回二')) {
            sleep(1000)
        }
        flag = false
    }
}